Skip to content

fix: propagate parent instance info in in-memory backend#263

Merged
YunchuWang merged 2 commits into
mainfrom
copilot-finds/bug/fix-missing-parent-instance-in-test-backend
Jun 12, 2026
Merged

fix: propagate parent instance info in in-memory backend#263
YunchuWang merged 2 commits into
mainfrom
copilot-finds/bug/fix-missing-parent-instance-in-test-backend

Conversation

@YunchuWang

Copy link
Copy Markdown
Member

Summary

Fixes #243

Copilot AI review requested due to automatic review settings June 11, 2026 20:53
…yOrchestrationBackend

InMemoryOrchestrationBackend.createInstance() did not accept or forward
parent instance info to the ExecutionStartedEvent, causing ctx.parent
to always be undefined for sub-orchestrations in the test environment.

The fix adds an optional parentInstance parameter to createInstance()
and passes the parent orchestration's name, instanceId, and
taskScheduledId from processCreateSubOrchestrationAction().

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@YunchuWang YunchuWang force-pushed the copilot-finds/bug/fix-missing-parent-instance-in-test-backend branch from 6f7d1d3 to 9116511 Compare June 11, 2026 20:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR closes the behavioral gap between the real sidecar and the in-memory test backend by propagating parent orchestration instance metadata into ExecutionStartedEvent for sub-orchestrations, enabling ctx.parent to be populated correctly during tests.

Changes:

  • Added an optional parentInstance parameter to InMemoryOrchestrationBackend.createInstance() and forwarded it into newExecutionStartedEvent(...).
  • Updated sub-orchestration creation to supply parent instance metadata (name, instanceId, taskScheduledId).
  • Added regression tests to verify ctx.parent is set for sub-orchestrations and remains undefined for top-level orchestrations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/durabletask-js/src/testing/in-memory-backend.ts Threads parent instance metadata into the in-memory backend’s ExecutionStartedEvent for sub-orchestrations.
packages/durabletask-js/test/in-memory-backend.spec.ts Adds coverage validating parent metadata propagation behavior in the test backend.

Comment thread packages/durabletask-js/src/testing/in-memory-backend.ts
Use the shared ParentOrchestrationInstance type for in-memory backend parent metadata instead of redefining the shape inline.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@YunchuWang YunchuWang merged commit bc471d0 into main Jun 12, 2026
28 checks passed
@YunchuWang YunchuWang deleted the copilot-finds/bug/fix-missing-parent-instance-in-test-backend branch June 12, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[copilot-finds] Bug: InMemoryOrchestrationBackend does not propagate parent instance info for sub-orchestrations

4 participants